//
//  TXFUser.swift
//  weibo飞飞
//
//  Created by 田侠飞 on 16/6/27.
//  Copyright © 2016年 田侠飞. All rights reserved.
//

import UIKit

class TXFUser: NSObject {

    var id : Int  = 0
    
    var name : String?
    
    var profile_image_url : String?
    var verifiedImageView : UIImage?
    
    var mbrankImageView: UIImage?
    
    
    var verified_type : Int = -1{
    
        didSet{
           verifiedImageView = getVipImage(verified_type)
            
        }

    
    
    
    }
    
    var mbrank: Int = 0{
        
        didSet{
      
          mbrankImageView = getmbrankImage(mbrank)
            
        }
        
        
        
        
    }
    
    
    init(dict: [String: AnyObject] ) {
        
     super.init()
        
        setValuesForKeysWithDictionary(dict)
        
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
}


extension TXFUser{

    func  getVipImage(Verified: Int)->UIImage?{
    
        switch Verified {
        
        case 0 :
            return UIImage(named: "avatar_vip")
            
        case 2,3,5:
            return UIImage(named: "avatar_enterprise_vip")
        
        case 200:
           
        return UIImage(named: "avatar_grassroot")
            
        default:
             return UIImage(named: "avatar_vgirl")
        
        }
    
    
    }
    func  getmbrankImage(mbrank: Int)->UIImage?{
    
        if mbrank > 0 && mbrank < 7 {
        
        return UIImage(named: "common_icon_membership_level\(mbrank)")
    
        }else{
        
        //默认图片:
            
            return UIImage(named: "common_icon_membership_expired")
        
        
        }
    
    
    
    
    }




}
